package day24;

/**
 * 题目：年终奖
 * 题目链接：https://www.nowcoder.com/practice/72a99e28381a407991f2c96d8cb238ab?tpId=49&&tqId=29305&rp=1&ru=/activity/oj&qru=/ta/2016test/question-ranking
 * dp[i][j] 到达i行j列位置时收货最大值
 */
public class Main {
    public int getMost(int[][] board) {
        // write code here
        int m = board.length;
        int n = board[0].length;
        int[][] dp = new int[m+1][n+1];
        for(int i = 1;i <= m;i++) {
            for(int j = 1;j <= n;j++) {
                dp[i][j] = Math.max(dp[i-1][j],dp[i][j-1])+board[i-1][j-1] ;
            }
        }
        return dp[m][n];
    }
}
